package shop.repository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;
import shop.model.User;

public interface UserRepository extends CrudRepository<User,String> {

    @Query("select u from User u where u.utele=?1 and u.upassword=?2")
    public User login(String utele,String upassword);


    @Modifying
    @Query(value = "update User u set u.password=?1 where u.utele=?2",nativeQuery = true)
    public User modify(String upassword,String utele);
}
